package com.csj.DesignPattern.facade;

//同RequestFacede
public class SmartApplicationsFacade {

    private Lighter lighter;
    private AC ac;
    private TV tv;

    public SmartApplicationsFacade() {
        this.lighter = new Lighter();
        this.ac = new AC();
        this.tv = new TV();

    }

    public void say(String message) {
        if (message.contains("打开")) {
            on();
        } else if (message.contains("关闭")) {
            off();
        } else {
            System.out.println("没有这个指令");
        }

    }

    private void on() {
        lighter.on();
        ac.on();
        tv.on();
    }
    private void off() {
        lighter.off();
        ac.off();
        tv.off();
    }
}
/*

public class RequestFacade implements HttpServletRequest {

    protected Request request = null;

    public RequestFacade(Request request) {
        this.request = request;
    }
    public Object getAttribute(String name) {
        return this.request.getAttribute(name);
    }
    public void setCharacterEncoding(String env) throws UnsupportedEncodingException {
        this.request.setCharacterEncoding(env);
    }
}

 */
